package cn.pzh.cloud.controller;

import cn.pzh.cloud.pojo.TbUser;
import cn.pzh.cloud.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
@RefreshScope
public class UserController {
    @Autowired
    private UserService userService;
    @Value("${pattern.dateformat}")
    private String date;
    @Value("${pattern.prop}")
    private String prop;
    @GetMapping("/date")
    public String showDate(){
       return date;
    }
    @GetMapping("/prop")
    public String showProp(){
        return prop;
    }
    @RequestMapping("/{userId}")
    public TbUser queryById(@PathVariable("userId") Integer userId, @RequestHeader("Truth")String truth){
        System.out.println(truth);
      return userService.queryByUserId(userId);
    }
}
